<script type="text/javascript" src="/public/js/jquery.1.72.js"></script>
<script type="text/javascript">
(function ($) {
$.fn.extend({
Scroll: function (opt, callback) {
if (!opt) var opt = {};
var _btnUp = $("#" + opt.up); //Shawphy:向上按钮
var _btnDown = $("#" + opt.down); //Shawphy:向下按钮
var _this = this.eq(0).find("ul:first");
var lineH = _this.find("li:first").height(); //获取行高
var line = opt.line ? parseInt(opt.line, 10) : parseInt(this.height() / lineH, 10); //每次滚动的行数，默认为一屏，即父容器高度
var speed = opt.speed ? parseInt(opt.speed, 10) : 600; //卷动速度，数值越大，速度越慢（毫秒）
var m = line;  //用于计算的变量
var count = _this.find("li").length; //总共的<li>元素的个数
var upHeight = line * lineH;
function scrollUp() {
if (!_this.is(":animated")) {  //判断元素是否正处于动画，如果不处于动画状态，则追加动画。
if (m < count) {  //判断 m 是否小于总的个数
m += line;
_this.animate({ marginTop: "-=" + upHeight + "px" }, speed);
}
}
}
function scrollDown() {
if (!_this.is(":animated")) {
if (m > line) { //判断m 是否大于一屏个数
m -= line;
_this.animate({ marginTop: "+=" + upHeight + "px" }, speed);
}
}
}
_btnUp.bind("click", scrollUp);
_btnDown.bind("click", scrollDown);
}
});
})(jQuery);
$(function () {
$("#scrollDiv").Scroll({ line: 2, speed: 500,up: "btn1", down: "btn2" });
});
</script>
<div class="ac_list_box">
<a href="javascript:;" id="btn2"><img src="/images/ac_up.jpg" /></a>
<div id="scrollDiv">
<ul>
<li class="ac_list">
<h3><a href="/active/3016.shtml">乐享樟宜，转机礼遇</a></h3><a class="tips" href="/active/3016.shtml"><img src="/Uploads/2013070605-53-banner000-1.jpg" height="117" width="261"></a></li>
<li class="ac_list">
<h3><a href="/active/307.shtml">成为百万富翁</a></h3><a class="tips" href="/active/307.shtml"><img src="/Uploads/2013070605-31-millionaire banner-1.jpg" height="117" width="261"></a></li>
<li class="ac_list">
<h3><a href="/active/3017.shtml">三大巨师之作 独特珍品全新呈现</a></h3><a class="tips" href="/active/3017.shtml"><img src="/Uploads/2013070508-19-changi-3a.jpg" height="117" width="261"></a></li>
<li class="ac_list">
<h3><a href="/active/3013.shtml">幻彩流星粉球（精美限量版）</a></h3><a class="tips" href="/active/3013.shtml"><img src="/Uploads/2013070508-40-changi-2a.jpg" height="117" width="261"></a></li>
<li class="ac_list">
<h3><a href="/active/206.shtml">全球首推 全新SK-II肌源臻效精华</a></h3><a class="tips" href="/active/206.shtml"><img src="/Uploads/2013070508-32-changi-1a.jpg" height="117" width="261"></a></li>
</ul>
</div>
<a href="javascript:;" id="btn1"><img src="/images/ac_down.jpg" /></a>
</div>
